//
//  TMessageCell.m
//  timelyRain
//
//  Created by Jiafei Wei on 16/9/26.
//  Copyright © 2016年 Jiafei Wei. All rights reserved.
//

#import "TMessageCell.h"
@interface TMessageCell()
@property (weak, nonatomic) IBOutlet UIImageView *call0ut_or_in;
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *phone;
@property (weak, nonatomic) IBOutlet UILabel *time;
@property (weak, nonatomic) IBOutlet UILabel *smsNumber;
@property (weak, nonatomic) IBOutlet UILabel *callNumber;
- (IBAction)call:(id)sender;
- (IBAction)send:(id)sender;

@end

@implementation TMessageCell

- (IBAction)call:(id)sender {
    
}
- (IBAction)send:(id)sender {
    
}
//创建自定义可重用的cell对象
+(instancetype)setTMessageCellWithTableView:(UITableView *)tableView
{
    static NSString *reuseId = @"TMessageCell";
    TMessageCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:@"TMessageCell" owner:nil options:nil] lastObject];
    }
    return cell;
}

-(void)setShowData:(MessageShow *)showData{
    _showData =showData;
    _name.text=_showData.name;
    _phone.text=_showData.phoneNumber;
    _time.text =_showData.callTime;
    if (_showData.missCallNumber!=0) {
        _callNumber.hidden=NO;
        _callNumber.text =_showData.missCallNumber;
    }else{
        _callNumber.hidden=YES;
    }
    if (_showData.missSMSNumber!=0) {
        _smsNumber.hidden=NO;
        _smsNumber.text =_showData.missCallNumber;
    }else{
        _smsNumber.hidden=YES;
    }
}

- (void)awakeFromNib{
    [super awakeFromNib];
    _smsNumber.layer.cornerRadius = _smsNumber.frame.size.height/2;
    _smsNumber.layer.masksToBounds =YES;
    _callNumber.layer.cornerRadius = _smsNumber.frame.size.height/2;
    _callNumber.layer.masksToBounds =YES;
}
@end
